package com.baseframe.blog.sign;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum BlogStatus {
    AUDIT(0,"待审核"),
    PUBLISHED(1,"已发布"),
    REVIEW_FAILED(2,"审核未通过")
    ;

    private final int code;
    private final String name;

    public static BlogStatus getStatusByCode(Integer code){
        BlogStatus status = null;
        for (BlogStatus value : values()) {
            if (code == value.code){
                status = value;
                break;
            }
        }

        return status;
    }

    public static String getNameByCode(Integer code){
        for (BlogStatus value : values()) {
            if (value.code == code){
                return value.name;
            }
        }

        return null;
    }


}
